package factory;

import color.Color;
import envase.Plastico;
import envase.TipoEnvase;
import figuraGeometrica.FiguraGeometrica;
import java.util.LinkedList;
import java.util.List;

public class FactoryPlasticoColor extends factory.EnvaseAbstractFactory {

    Plastico plastico = new Plastico();
    FiguraGeometrica figura = new FiguraGeometrica();
    Color color = new Color();
    
    List<FiguraGeometrica> figuras;
    List<Color> colores = new LinkedList();

    String fig;
    String col;

    public FactoryPlasticoColor(String fig, String col) {
        this.fig = fig;
        this.col = col;
    }
    
    @Override
    public TipoEnvase crearTipo() {
        return plastico.crearTipoEnvase();
    }

    @Override
    public FiguraGeometrica crearFiguraGeometrica() {
        figuras = figura.getFiguras();
        
        FiguraGeometrica fg = new FiguraGeometrica();
        for (FiguraGeometrica fiGeo : figuras) {
            if (fiGeo.getTipo().trim().equals(fig)) {
                fg = fiGeo;
            }
        }
        return fg;
    }

    @Override
    public Color crearColor() {
        colores = color.getColores();
        
        Color cl = new Color();
        for (Color clr : colores) {
            if (clr.getNombre().trim().equals(col)) {
                cl = clr;
            }
        }
        return cl;
    }
}